/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package src;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Point;
import javax.swing.JFrame;
import javax.swing.JTextArea;

/**
 *
 * @author lcl
 */
public class newJTextAreaTest extends JTextArea
{
   private GradientPaint gradient = null;
   private Point firstPoint = null;
   private Point secondPoint = null;


    void newJTextAreaTest()
    {
        this.setBackground( Color.lightGray );
        firstPoint = new Point( 500, 0 );
        secondPoint = new Point( 0, 200 );
        gradient = new GradientPaint( firstPoint, Color.green, secondPoint, Color.blue );
        Graphics2D d = ( Graphics2D ) getGraphics();
        d.setPaint( gradient );
        paint( d );
        repaint();
    }

    @Override
    public void paint( Graphics g )
    {
        Graphics2D g2d = ( Graphics2D ) g;

        g2d.setPaint( gradient );
        
        super.paint( g );
    }

    public static void main( String args[] )
    {
        JFrame f = new JFrame();
        final newJTextAreaTest box = new newJTextAreaTest();

        f.setLayout( new GridLayout() );

        f.setDefaultCloseOperation( f.EXIT_ON_CLOSE );

        f.setSize( 200, 130 );

        f.add( box );

        f.setVisible( true );






        //box.setBounds( box.getVisibleRect() );
        //box.setColors( new Color( 150, 230, 230 ), Color.white );

//        b.addMouseListener( new MouseListener()
//        {
//
//            public void mouseClicked( MouseEvent e )
//            {
//                box.setTransition( 0, 0, box.getSize().width, 0 );
//            }
//
//            public void mousePressed( MouseEvent e )
//            {
//            }
//
//            public void mouseReleased( MouseEvent e )
//            {
//            }
//
//            public void mouseEntered( MouseEvent e )
//            {
//            }
//
//            public void mouseExited( MouseEvent e )
//            {
//            }
//        } );
    }
}
